create table Concern
(
	 [ConcernId] int identity(1, 1) primary key
	,[ConcernFullName] nvarchar(128)
	,[ConcernSortName] nvarchar(128)
	,[ConcernEnglishName] nvarchar(128)
	,[SortDescription] nvarchar(512)
	,[DetailDescription] nvarchar(max)
	,[Phone] varchar(32)
	,[Hotline] varchar(32)
	,[Fax] varchar(32)
	,[Email] nvarchar(128)
	,[Website] nvarchar(128)
	,[RepresentName] nvarchar(128)
	,[Regency] nvarchar(128)
	,[ContinentId] int
	,[NationalId] int
	,[CityId] int
	,[DistrictId] int
	,[WardId] int
	,[Address] nvarchar(128)
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

CREATE PROCEDURE ConcernGet
	@ConcernId int
AS
SELECT *
FROM [Concern]
WHERE [Concern].[ConcernId] = @ConcernId
GO

CREATE PROCEDURE ConcernList
AS
SELECT *
FROM [Concern]
ORDER BY ConcernId DESC
GO

CREATE PROCEDURE ConcernInsert
	 @ConcernFullName nvarchar(128)
	,@ConcernSortName nvarchar(128)
	,@ConcernEnglishName nvarchar(128)
	,@SortDescription nvarchar(512)
	,@DetailDescription nvarchar(max)
	,@Phone varchar(32)
	,@Hotline varchar(32)
	,@Fax varchar(32)
	,@Email nvarchar(128)
	,@Website nvarchar(128)
	,@RepresentName nvarchar(128)
	,@Regency nvarchar(128)
	,@ContinentId int
	,@NationalId int
	,@CityId int
	,@DistrictId int
	,@WardId int
	,@Address nvarchar(128)
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO Concern (
	 [ConcernFullName]
	,[ConcernSortName]
	,[ConcernEnglishName]
	,[SortDescription]
	,[DetailDescription]
	,[Phone]
	,[Hotline]
	,[Fax]
	,[Email]
	,[Website]
	,[RepresentName]
	,[Regency]
	,[ContinentId]
	,[NationalId]
	,[CityId]
	,[DistrictId]
	,[WardId]
	,[Address]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @ConcernFullName
	,@ConcernSortName
	,@ConcernEnglishName
	,@SortDescription
	,@DetailDescription
	,@Phone
	,@Hotline
	,@Fax
	,@Email
	,@Website
	,@RepresentName
	,@Regency
	,@ContinentId
	,@NationalId
	,@CityId
	,@DistrictId
	,@WardId
	,@Address
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

CREATE PROCEDURE ConcernUpdate
	@ConcernId int, 
	@ConcernFullName nvarchar(128), 
	@ConcernSortName nvarchar(128), 
	@ConcernEnglishName nvarchar(128), 
	@SortDescription nvarchar(512), 
	@DetailDescription nvarchar(max), 
	@Phone varchar(32), 
	@Hotline varchar(32), 
	@Fax varchar(32), 
	@Email nvarchar(128), 
	@Website nvarchar(128), 
	@RepresentName nvarchar(128), 
	@Regency nvarchar(128), 
	@ContinentId int, 
	@NationalId int, 
	@CityId int, 
	@DistrictId int, 
	@WardId int, 
	@Address nvarchar(128), 
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 

AS

UPDATE Concern SET
	    [ConcernFullName] = @ConcernFullName
	   ,[ConcernSortName] = @ConcernSortName
	   ,[ConcernEnglishName] = @ConcernEnglishName
	   ,[SortDescription] = @SortDescription
	   ,[DetailDescription] = @DetailDescription
	   ,[Phone] = @Phone
	   ,[Hotline] = @Hotline
	   ,[Fax] = @Fax
	   ,[Email] = @Email
	   ,[Website] = @Website
	   ,[RepresentName] = @RepresentName
	   ,[Regency] = @Regency
	   ,[ContinentId] = @ContinentId
	   ,[NationalId] = @NationalId
	   ,[CityId] = @CityId
	   ,[DistrictId] = @DistrictId
	   ,[WardId] = @WardId
	   ,[Address] = @Address
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [Concern].[ConcernId] = @ConcernId
GO

CREATE PROCEDURE ConcernDelete
	@ConcernId int
AS
DELETE FROM Concern
WHERE [Concern].[ConcernId] = @ConcernId
GO